package mmi.gui.widget;

import java.awt.Insets;

import javax.swing.ImageIcon;
import javax.swing.JButton;

public class WidgetUtils {
	public static JButton initialiseDrawingBarButton(String text, String iconLocation)
	{
		return initialiseDrawingBarButton(text, iconLocation, true);
	}

	public static JButton initialiseDrawingBarButton(String text, String iconLocation, boolean showText)
	{
		JButton button = new JButton();
		button.setIcon(new ImageIcon("img/" + iconLocation));
		button.setToolTipText(text);
		button.setMargin(new Insets(0, 0, 0, 0));
		button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
		button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
		if(showText)
		{
			button.setText(text);
		}

		return button;
	}
}
